import {page, pageFunc} from "../common/PageBuilder";
import {BasePage, BasePageData} from "../common/core/BasePage";
import {UserPage} from "../common/partPages/UserPage";
import {userMgr, waitForLogin} from "../../modules/userModule/managers/UserManager";
import {waitForDataLoad} from "../../modules/coreModule/managers/DataManager";
import {iLevelRepo, InstructorLevel} from "../../modules/userModule/data/Role";
import {field} from "../../modules/coreModule/data/DataLoader";

class Data extends BasePageData {

	@field(InstructorLevel)
	level: InstructorLevel
}

@page("privilege", "等级特权")
export class PrivilegePage extends BasePage<Data> {

	public data = new Data()

	/**
	 * 部分页
	 */
	public userPage: UserPage = new UserPage();

	onLoad(e) {
		super.onLoad(e);
		this.loadData();
	}

	@waitForLogin
	@waitForDataLoad
	loadData() {
		this.setData({
			level: userMgr().userInfo.certification?.level
		})
	}

}
